package com.example.sxt_practise.IO;

import java.io.*;

/**
 * 转换流 InputStreamReader
 * OutputStreamWriter
 * 可以指定字符集,避免乱码
 *
 * @author gaofeng
 * @date 2022年05月10日 20:54
 */
public class ConvertStreamTest {
    public static void main(String[] args) {

        String msg = "";

        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
             BufferedWriter writer = new BufferedWriter(new OutputStreamWriter((System.out)));) {
            while (!msg.equals("exit")) {
                msg = reader.readLine();
                writer.write(msg);
                writer.newLine();
                writer.flush();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
